<template>
  <div id="SystemInf">
    <a-table
      :scroll="{ y: 580 }"
      :columns="columns"
      style="margin-top: 16px"
      :data-source="tableData"
      :pagination="tablePagination"
      :row-selection="{
        selectedRowKeys: selectedRowKeys,
        onChange: onSelectChange,
      }"
      :rowKey="(record, index) => index"
    >
      <template slot="name" slot-scope="text, record">
        <a-tooltip placement="top" v-if="record.name">
          <template slot="title">
            <span>{{ record.name }}</span>
          </template>
          <span style="cursor: default">{{ record.name }}</span>
        </a-tooltip>
        <span v-else-if="!record.name">—</span>
      </template>
      <template slot="tapdProjectId" slot-scope="text, record">
        <a-tooltip placement="top" v-if="record.tapdProjectId">
          <template slot="title">
            <p>{{ record.tapdProjectId }}</p>
          </template>
          <span style="cursor: default">{{ record.tapdProjectId }}</span>
        </a-tooltip>
        <span v-else-if="!record.tapdProjectId">—</span>
      </template>
    </a-table>
  </div>
</template>
  
  <script>
export default {
  data() {
    return {
      selectedRowKeys: [],
      columns: [
        //主页table列的配置
        {
          title: "运行使用",
          dataIndex: "userName",
          customRender: (text, record) => {
            return record.userName ? record.userName : "—";
          },
        },
        {
          title: "保障维护",
          dataIndex: "actionLog",
          customRender: (text, record) => {
            return record.actionLog ? record.actionLog : "—";
          },
        },
      ],
      tableData: [
        //主页表格的数据
      ],
      tablePagination: {
        //主页表格的分页器
        showQuickJumper: true, //是否可以快速跳转至某页
        showSizeChanger: true, //是否可以改变 pageSize
      },
    };
  },
  created(){
    this.getData();
  },
  methods: {
    async getData() {
      let data = await this.$axios.get("/sys/systemLog/page");
      this.tableData = data.response;
      this.tablePagination.total = data.response.length;
    },
    onSelectChange(selectedRowKeys) {
      console.log("selectedRowKeys changed: ", selectedRowKeys);
      this.selectedRowKeys = selectedRowKeys;
    },
  },
};
</script>
  
  <style>
</style>